<script setup lang="ts">
interface Props {
  icon?: string
  title?: string
  description?: string
  buttonText?: string
  showButton?: boolean
}

interface Emits {
  (e: 'buttonClick'): void
}

withDefaults(defineProps<Props>(), {
  icon: 'goods',
  title: '暂无内容',
  description: '',
  buttonText: '去看看',
  showButton: false
})

defineEmits<Emits>()
</script>

<template>
  <view class="empty-state">
    <view class="empty-icon">
      <wd-icon :name="icon" size="80px" color="#ddd" />
    </view>
    
    <text class="empty-title">{{ title }}</text>
    
    <text v-if="description" class="empty-description">{{ description }}</text>
    
    <wd-button
      v-if="showButton"
      type="primary"
      size="large"
      custom-class="empty-button"
      @click="$emit('buttonClick')"
    >
      {{ buttonText }}
    </wd-button>
  </view>
</template>

<style lang="scss" scoped>
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;

  .empty-icon {
    margin-bottom: 20px;
  }

  .empty-title {
    font-size: 16px;
    color: #999;
    margin-bottom: 8px;
  }

  .empty-description {
    font-size: 14px;
    color: #ccc;
    text-align: center;
    line-height: 1.4;
    margin-bottom: 30px;
  }

  :deep(.empty-button) {
    width: 200px;
  }
}
</style>